<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
   xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui" xmlns:pb="http://b2b.pb.com/tags">

<ui:composition template="/template/MainTemplate.xhtml">
   <ui:define name="body">
      <pb:saveBean beanName="categoryBean" bean="#{categoryBean}" />

      <h:panelGroup rendered="#{empty categoryBean.defaultCategoryLanguages}">
         <div class="error_msg">
            <div class="error_msg_top"> 
               <div class="error_msg_img" />
            </div>
            <div class="error_msg_cont">
               <div class="error_msg_txt">
                  <h:outputText value="#{categoryBundle.category_list_empty}" />
               </div>
            </div>
            <div class="error_msg_bottom" />
         </div>
      </h:panelGroup>

      <p:panel id="treePanel" rendered="#{not empty categoryBean.defaultCategoryLanguages}"
         header="#{categoryBundle.create_category_tbl_header}">
         <p:treeTable value="#{categoryBean.root}" var="categoryLanguage" selection="#{categoryBean.selectedNode}"
            selectionMode="single">

            <p:column style="width:150px" headerText="#{categoryBundle.lbl_category_name}">
               <h:outputText value="#{categoryLanguage.name}" />
            </p:column>

            <p:column style="width:150px" headerText="#{categoryBundle.lbl_description}">
               <h:outputText value="#{categoryLanguage.description}" />
            </p:column>

            <p:column style="width:150px" headerText="#{categoryBundle.lbl_row}">
               <h:outputText value="#{categoryLanguage.category.rowNumber}" />
            </p:column>

            <p:column style="width:150px" headerText="#{categoryBundle.lbl_status}">
               <h:outputText value="#{categoryLanguage.category.status}" />
            </p:column>
         </p:treeTable>
      </p:panel>

      <p:tree rendered="false" id="treeSingle" value="#{categoryBean.root}" var="node" selectionMode="single"
         selection="{categoryBean.selectedNode}">

         <p:treeNode>
            <h:outputText value="node" />
         </p:treeNode>
      </p:tree>

      <p:panel header="#{languageBundle.language_tbl_header}"
         rendered="#{false and not empty languageBean.languageList}">
         <p:dataTable id="langDTable" var="language" value="#{languageBean.languageList}" rowKey="#{language.id}"
            selection="#{languageBean.selectedLanguage}" paginator="#{languageBean.languageList.size() > 10}" rows="10">

            <p:column selectionMode="single" style="width:30px" />

            <p:column headerText="#{languageBundle.lbl_language_name}">
               <h:outputText value="#{language.name}" />
            </p:column>

            <p:column headerText="#{languageBundle.lbl_language_code}">
               <h:outputText value="#{language.code}" />
            </p:column>

            <p:column headerText="#{languageBundle.lbl_language_active}" style="text-align:center;">
               <h:outputText value="#{language.active}" />
            </p:column>

            <p:column headerText="#{languageBundle.lbl_language_status}">
               <h:outputText value="#{languageBean.getStatusText(language.status)}" />
            </p:column>
         </p:dataTable>
      </p:panel>

      <h:panelGroup id="buttonsPanel">
         <div class="marginTop7">
            <div class="btnRightCol">
               <p:commandButton action="CreateCategoryStart?faces-redirect=true"
                  value="#{categoryBundle.btn_create_category}" ajax="false" styleClass="btn200" />
            </div>
            <h:panelGroup rendered="#{not empty categoryBean.defaultCategoryLanguages}">
               <div class="btnRightCol">
                  <p:commandButton action="#{categoryBean.initChangeCategory}"
                     value="#{categoryBundle.btn_change_category}" ajax="false" styleClass="btn200" />
               </div>
               <div class="btnRightCol">
                  <p:commandButton action="{categoryBean.changeRowConfirmAction}"
                     value="#{categoryBundle.btn_change_category_row}" ajax="false" styleClass="btn200" />
               </div>
            </h:panelGroup>
         </div>
      </h:panelGroup>

   </ui:define>
</ui:composition>
</html>